<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter&nbsp;17.&nbsp;Using Ant from Gradle</title>
<link xmlns:xslthl="http://xslthl.sf.net" type="text/css"
	rel="stylesheet" href="./css/base.css">
<link xmlns:xslthl="http://xslthl.sf.net" type="text/css"
	rel="stylesheet" href="./css/docs.css">
<link xmlns:xslthl="http://xslthl.sf.net" type="text/css"
	rel="stylesheet" href="./css/userguide.css">
<meta content="DocBook XSL Stylesheets V1.75.2" name="generator">
<link rel="home" href="userguide.html" title="Gradle User Guide">
<link rel="up" href="userguide.html" title="Gradle User Guide">
<link rel="prev" href="working_with_files.html"
	title="Chapter&nbsp;16.&nbsp;Working With Files">
<link rel="next" href="logging.html"
	title="Chapter&nbsp;18.&nbsp;Logging">
</head>
<body>
	<div class="navheader">
		<div>
			<div class="navbar">
				<a xmlns:xslthl="http://xslthl.sf.net"
					href="working_with_files.html"
					title="Chapter&nbsp;16.&nbsp;Working With Files">Previous</a><span>|</span><a
					xmlns:xslthl="http://xslthl.sf.net" href="userguide.html"
					title="Gradle User Guide">Contents</a><span>|</span><a
					xmlns:xslthl="http://xslthl.sf.net" href="logging.html"
					title="Chapter&nbsp;18.&nbsp;Logging">Next</a>
			</div>
		</div>
	</div>
	<div class="chapter">
		<div class="titlepage">
			<div>
				<div>
					<h1 xmlns:xslthl="http://xslthl.sf.net">
						<a name="ant"></a>Chapter&nbsp;17.&nbsp;Using Ant from Gradle
					</h1>
				</div>
			</div>
		</div>
		<p>Gradle provides excellent integration with Ant. You can use
			individual Ant tasks or entire Ant builds in your Gradle builds. In
			fact, you will find that it's far easier and more powerful using Ant
			tasks in a Gradle build script, than it is to use Ant's XML format.
			You could even use Gradle simply as a powerful Ant task scripting
			tool.</p>
		<p>
			Ant can be divided into two layers. The first layer is the Ant
			language. It provides the syntax for the
			<code class="filename">build.xml</code>
			, the handling of the targets, special constructs like macrodefs, and
			so on. In other words, everything except the Ant tasks and types.
			Gradle understands this language, and allows you to import your Ant
			<code class="filename">build.xml</code>
			directly into a Gradle project. You can then use the targets of your
			Ant build as if they were Gradle tasks.
		</p>
		<p>
			The second layer of Ant is its wealth of Ant tasks and types, like
			<code class="literal">javac</code>
			,
			<code class="literal">copy</code>
			or
			<code class="literal">jar</code>
			. For this layer Gradle provides integration simply by relying on
			Groovy, and the fantastic
			<code class="literal">AntBuilder</code>
			.
		</p>
		<p>
			Finally, since build scripts are Groovy scripts, you can always
			execute an Ant build as an external process. Your build script may
			contain statements like:
			<code class="literal">"ant clean compile".execute()</code>
			. <sup>[<a href="#ftn.N113DF" name="N113DF" class="footnote">8</a>]
			</sup>
		</p>
		<p>You can use Gradle's Ant integration as a path for migrating
			your build from Ant to Gradle. For example, you could start by
			importing your existing Ant build. Then you could move your
			dependency declarations from the Ant script to your build file.
			Finally, you could move your tasks across to your build file, or
			replace them with some of Gradle's plugins. This process can be done
			in parts over time, and you can have a working Gradle build during
			the entire process.</p>
		<div class="section">
			<div class="titlepage">
				<div>
					<div>
						<h2 class="title">
							<a name="N113E5"></a>17.1.&nbsp;Using Ant tasks and types in your
							build
						</h2>
					</div>
				</div>
			</div>
			<p>
				In your build script, a property called
				<code class="literal">ant</code>
				is provided by Gradle. This is a reference to an <a class="ulink"
					href="../javadoc/org/gradle/api/AntBuilder.html" target="_top"><code
						class="classname">AntBuilder</code></a> instance. This
				<code class="literal">AntBuilder</code>
				is used to access Ant tasks, types and properties from your build
				script. There is a very simple mapping from Ant's
				<code class="filename">build.xml</code>
				format to Groovy, which is explained below.
			</p>
			<p>
				You execute an Ant task by calling a method on the
				<code class="literal">AntBuilder</code>
				instance. You use the task name as the method name. For example, you
				execute the Ant
				<code class="literal">echo</code>
				task by calling the
				<code class="literal">ant.echo()</code>
				method. The attributes of the Ant task are passed as Map parameters
				to the method. Below is an example which executes the
				<code class="literal">echo</code>
				task. Notice that we can also mix Groovy code and the Ant task
				markup. This can be extremely powerful.
			</p>
			<div class="example">
				<a name="useAntTask"></a>
				<p class="title">
					<b>Example&nbsp;17.1.&nbsp;Using an Ant task</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">task hello &lt;&lt; {
    String greeting = <span xmlns:xslthl="http://xslthl.sf.net"
							class="hl-string">'hello from Ant'</span>
    ant.echo(message: greeting)
}</pre>
					<p>
						Output of <strong class="userinput"><code>gradle
								hello</code></strong>
					</p>
					<pre class="screen">&gt; gradle hello
:hello
[ant:echo] hello from Ant

BUILD SUCCESSFUL

Total time: 1 secs</pre>
				</div>
			</div>
			<br class="example-break">
			<p>
				You pass nested text to an Ant task by passing it as a parameter of
				the task method call. In this example, we pass the message for the
				<code class="literal">echo</code>
				task as nested text:
			</p>
			<div class="example">
				<a name="taskWithNestedText"></a>
				<p class="title">
					<b>Example&nbsp;17.2.&nbsp;Passing nested text to an Ant task</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">task hello &lt;&lt; {
    ant.echo(<span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'hello from Ant'</span>)
}</pre>
					<p>
						Output of <strong class="userinput"><code>gradle
								hello</code></strong>
					</p>
					<pre class="screen">&gt; gradle hello
:hello
[ant:echo] hello from Ant

BUILD SUCCESSFUL

Total time: 1 secs</pre>
				</div>
			</div>
			<br class="example-break">
			<p>You pass nested elements to an Ant task inside a closure.
				Nested elements are defined in the same way as tasks, by calling a
				method with the same name as the element we want to define.</p>
			<div class="example">
				<a name="taskWithNestedElements"></a>
				<p class="title">
					<b>Example&nbsp;17.3.&nbsp;Passing nested elements to an Ant
						task</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">task zip &lt;&lt; {
    ant.zip(destfile: <span xmlns:xslthl="http://xslthl.sf.net"
							class="hl-string">'archive.zip'</span>) {
        fileset(dir: <span xmlns:xslthl="http://xslthl.sf.net"
							class="hl-string">'src'</span>) {
            include(name: <span xmlns:xslthl="http://xslthl.sf.net"
							class="hl-string">'**.xml'</span>)
            exclude(name: <span xmlns:xslthl="http://xslthl.sf.net"
							class="hl-string">'**.java'</span>)
        }
    }
}</pre>
				</div>
			</div>
			<br class="example-break">
			<p>
				You can access Ant types in the same way that you access tasks,
				using the name of the type as the method name. The method call
				returns the Ant data type, which you can then use directly in your
				build script. In the following example, we create an Ant
				<code class="literal">path</code>
				object, then iterate over the contents of it.
			</p>
			<div class="example">
				<a name="useAntType"></a>
				<p class="title">
					<b>Example&nbsp;17.4.&nbsp;Using an Ant type</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">task list &lt;&lt; {
    def path = ant.path {
        fileset(dir: <span xmlns:xslthl="http://xslthl.sf.net"
							class="hl-string">'libs'</span>, includes: <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'*.jar'</span>)
    }
    path.list().each {
        println it
    }
}</pre>
				</div>
			</div>
			<br class="example-break">
			<p>
				More information about
				<code class="literal">AntBuilder</code>
				can be found in 'Groovy in Action' 8.4 or at the <a class="ulink"
					href="http://groovy.codehaus.org/Using+Ant+from+Groovy"
					target="_top">Groovy Wiki</a>
			</p>
			<div class="section">
				<div class="titlepage">
					<div>
						<div>
							<h3 class="title">
								<a name="N1144F"></a>17.1.1.&nbsp;Using custom Ant tasks in your
								build
							</h3>
						</div>
					</div>
				</div>
				<p>
					To make custom tasks available in your build, you can use the
					<code class="literal">taskdef</code>
					(usually easier) or
					<code class="literal">typedef</code>
					Ant task, just as you would in a
					<code class="literal">build.xml</code>
					file. You can then refer to the custom Ant task as you would a
					built-in Ant task.
				</p>
				<div class="example">
					<a name="useExternalAntTask"></a>
					<p class="title">
						<b>Example&nbsp;17.5.&nbsp;Using a custom Ant task</b>
					</p>
					<div class="example-contents">
						<p>
							<code class="filename">build.gradle</code>
						</p>
						<pre class="programlisting">task check &lt;&lt; {
    ant.taskdef(resource: <span xmlns:xslthl="http://xslthl.sf.net"
								class="hl-string">'checkstyletask.properties'</span>) {
        classpath {
            fileset(dir: <span xmlns:xslthl="http://xslthl.sf.net"
								class="hl-string">'libs'</span>, includes: <span
								xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'*.jar'</span>)
        }
    }
    ant.checkstyle(config: <span xmlns:xslthl="http://xslthl.sf.net"
								class="hl-string">'checkstyle.xml'</span>) {
        fileset(dir: <span xmlns:xslthl="http://xslthl.sf.net"
								class="hl-string">'src'</span>)
    }
}</pre>
					</div>
				</div>
				<br class="example-break">
				<p>
					You can use Gradle's dependency management to assemble the
					classpath to use for the custom tasks. To do this, you need to
					define a custom configuration for the classpath, then add some
					dependencies to the configuration. This is described in more detail
					in <a class="xref"
						href="dependency_management.html#sec:how_to_declare_your_dependencies">Section&nbsp;50.4,
						&ldquo;How to declare your dependencies&rdquo;</a>.
				</p>
				<div class="example">
					<a name="useExternalAntTaskWithConfig"></a>
					<p class="title">
						<b>Example&nbsp;17.6.&nbsp;Declaring the classpath for a
							custom Ant task</b>
					</p>
					<div class="example-contents">
						<p>
							<code class="filename">build.gradle</code>
						</p>
						<pre class="programlisting">configurations {
    pmd
}

dependencies {
    pmd group: <span xmlns:xslthl="http://xslthl.sf.net"
								class="hl-string">'pmd'</span>, name: <span
								xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'pmd'</span>, version: <span
								xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'4.2.5'</span>
}</pre>
					</div>
				</div>
				<br class="example-break">
				<p>
					To use the classpath configuration, use the
					<code class="literal">asPath</code>
					property of the custom configuration.
				</p>
				<div class="example">
					<a name="useExternalAntTaskWithConfig"></a>
					<p class="title">
						<b>Example&nbsp;17.7.&nbsp;Using a custom Ant task and
							dependency management together</b>
					</p>
					<div class="example-contents">
						<p>
							<code class="filename">build.gradle</code>
						</p>
						<pre class="programlisting">task check &lt;&lt; {
    ant.taskdef(name: <span xmlns:xslthl="http://xslthl.sf.net"
								class="hl-string">'pmd'</span>, classname: <span
								xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'net.sourceforge.pmd.ant.PMDTask'</span>, classpath: configurations.pmd.asPath)
    ant.pmd(shortFilenames: <span xmlns:xslthl="http://xslthl.sf.net"
								class="hl-string">'true'</span>, failonruleviolation: <span
								xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'true'</span>, rulesetfiles: file(<span
								xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'pmd-rules.xml'</span>).toURI().toString()) {
        formatter(type: <span xmlns:xslthl="http://xslthl.sf.net"
								class="hl-string">'text'</span>, toConsole: <span
								xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'true'</span>)
        fileset(dir: <span xmlns:xslthl="http://xslthl.sf.net"
								class="hl-string">'src'</span>)
    }
}</pre>
					</div>
				</div>
				<br class="example-break">
			</div>
		</div>
		<div class="section">
			<div class="titlepage">
				<div>
					<div>
						<h2 class="title">
							<a name="N11485"></a>17.2.&nbsp;Importing an Ant build
						</h2>
					</div>
				</div>
			</div>
			<p>
				You can use the
				<code class="literal">ant.importBuild()</code>
				method to import an Ant build into your Gradle project. When you
				import an Ant build, each Ant target is treated as a Gradle task.
				This means you can manipulate and execute the Ant targets in exactly
				the same way as Gradle tasks.
			</p>
			<div class="example">
				<a name="antHello"></a>
				<p class="title">
					<b>Example&nbsp;17.8.&nbsp;Importing an Ant build</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">ant.importBuild <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'build.xml'</span>
					</pre>
					<p>
						<code class="filename">build.xml</code>
					</p>
					<pre class="programlisting">
						<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;project&gt;</span>
    <span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;target</span> <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">name</span>=<span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"hello"</span><span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&gt;</span>
        <span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;echo&gt;</span>Hello, from Ant<span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;/echo&gt;</span>
    <span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;/target&gt;</span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;/project&gt;</span>
					</pre>
					<p>
						Output of <strong class="userinput"><code>gradle
								hello</code></strong>
					</p>
					<pre class="screen">&gt; gradle hello
:hello
[ant:echo] Hello, from Ant

BUILD SUCCESSFUL

Total time: 1 secs</pre>
				</div>
			</div>
			<br class="example-break">
			<p>You can add a task which depends on an Ant target:</p>
			<div class="example">
				<a name="dependsOnAntTarget"></a>
				<p class="title">
					<b>Example&nbsp;17.9.&nbsp;Task that depends on Ant target</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">ant.importBuild <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'build.xml'</span>

task intro(dependsOn: hello) &lt;&lt; {
    println <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'Hello, from Gradle'</span>
}</pre>
					<p>
						Output of <strong class="userinput"><code>gradle
								intro</code></strong>
					</p>
					<pre class="screen">&gt; gradle intro
:hello
[ant:echo] Hello, from Ant
:intro
Hello, from Gradle

BUILD SUCCESSFUL

Total time: 1 secs</pre>
				</div>
			</div>
			<br class="example-break">
			<p>Or, you can add behaviour to an Ant target:</p>
			<div class="example">
				<a name="addBehaviourToAntTarget"></a>
				<p class="title">
					<b>Example&nbsp;17.10.&nbsp;Adding behaviour to an Ant target</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">ant.importBuild <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'build.xml'</span>

hello &lt;&lt; {
    println <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'Hello, from Gradle'</span>
}</pre>
					<p>
						Output of <strong class="userinput"><code>gradle
								hello</code></strong>
					</p>
					<pre class="screen">&gt; gradle hello
:hello
[ant:echo] Hello, from Ant
Hello, from Gradle

BUILD SUCCESSFUL

Total time: 1 secs</pre>
				</div>
			</div>
			<br class="example-break">
			<p>It is also possible for an Ant target to depend on a Gradle
				task:</p>
			<div class="example">
				<a name="dependsOnTask"></a>
				<p class="title">
					<b>Example&nbsp;17.11.&nbsp;Ant target that depends on Gradle
						task</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">ant.importBuild <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'build.xml'</span>

task intro &lt;&lt; {
    println <span xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'Hello, from Gradle'</span>
}</pre>
					<p>
						<code class="filename">build.xml</code>
					</p>
					<pre class="programlisting">
						<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;project&gt;</span>
    <span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;target</span> <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">name</span>=<span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"hello"</span> <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">depends</span>=<span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"intro"</span><span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&gt;</span>
        <span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;echo&gt;</span>Hello, from Ant<span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;/echo&gt;</span>
    <span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;/target&gt;</span>
<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;/project&gt;</span>
					</pre>
					<p>
						Output of <strong class="userinput"><code>gradle
								hello</code></strong>
					</p>
					<pre class="screen">&gt; gradle hello
:intro
Hello, from Gradle
:hello
[ant:echo] Hello, from Ant

BUILD SUCCESSFUL

Total time: 1 secs</pre>
				</div>
			</div>
			<br class="example-break">
		</div>
		<div class="section">
			<div class="titlepage">
				<div>
					<div>
						<h2 class="title">
							<a name="N114DF"></a>17.3.&nbsp;Ant properties and references
						</h2>
					</div>
				</div>
			</div>
			<p>
				There are several ways to set an Ant property, so that the property
				can be used by Ant tasks. You can set the property directly on the
				<code class="literal">AntBuilder</code>
				instance. The Ant properties are also available as a Map which you
				can change. You can also use the Ant
				<code class="literal">property</code>
				task. Below are some examples of how to do this.
			</p>
			<div class="example">
				<a name="antProperties"></a>
				<p class="title">
					<b>Example&nbsp;17.12.&nbsp;Setting an Ant property</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">ant.buildDir = buildDir
ant.properties.buildDir = buildDir
ant.properties[<span xmlns:xslthl="http://xslthl.sf.net"
							class="hl-string">'buildDir'</span>] = buildDir
ant.property(name: <span xmlns:xslthl="http://xslthl.sf.net"
							class="hl-string">'buildDir'</span>, location: buildDir)</pre>
					<p>
						<code class="filename">build.xml</code>
					</p>
					<pre class="programlisting">
						<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;echo&gt;</span>buildDir = ${buildDir}<span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;/echo&gt;</span>
					</pre>
				</div>
			</div>
			<br class="example-break">
			<p>
				Many Ant tasks set properties when they execute. There are several
				ways to get the value of these properties. You can get the property
				directly from the
				<code class="literal">AntBuilder</code>
				instance. The Ant properties are also available as a Map. Below are
				some examples.
			</p>
			<div class="example">
				<a name="antProperties"></a>
				<p class="title">
					<b>Example&nbsp;17.13.&nbsp;Getting an Ant property</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.xml</code>
					</p>
					<pre class="programlisting">
						<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;property</span> <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">name</span>=<span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"antProp"</span> <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">value</span>=<span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"a property defined in an Ant build"</span><span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">/&gt;</span>
					</pre>
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">println ant.antProp
println ant.properties.antProp
println ant.properties[<span xmlns:xslthl="http://xslthl.sf.net"
							class="hl-string">'antProp'</span>]</pre>
				</div>
			</div>
			<br class="example-break">
			<p>There are several ways to set an Ant reference:</p>
			<div class="example">
				<a name="antProperties"></a>
				<p class="title">
					<b>Example&nbsp;17.14.&nbsp;Setting an Ant reference</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">ant.path(id: <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'classpath'</span>, location: <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'libs'</span>)
ant.references.classpath = ant.path(location: <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'libs'</span>)
ant.references[<span xmlns:xslthl="http://xslthl.sf.net"
							class="hl-string">'classpath'</span>] = ant.path(location: <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-string">'libs'</span>)</pre>
					<p>
						<code class="filename">build.xml</code>
					</p>
					<pre class="programlisting">
						<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;path</span> <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">refid</span>=<span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"classpath"</span><span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">/&gt;</span>
					</pre>
				</div>
			</div>
			<br class="example-break">
			<p>There are several ways to get an Ant reference:</p>
			<div class="example">
				<a name="antProperties"></a>
				<p class="title">
					<b>Example&nbsp;17.15.&nbsp;Getting an Ant reference</b>
				</p>
				<div class="example-contents">
					<p>
						<code class="filename">build.xml</code>
					</p>
					<pre class="programlisting">
						<span xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">&lt;path</span> <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">id</span>=<span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"antPath"</span> <span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-attribute">location</span>=<span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-value">"libs"</span><span
							xmlns:xslthl="http://xslthl.sf.net" class="hl-tag">/&gt;</span>
					</pre>
					<p>
						<code class="filename">build.gradle</code>
					</p>
					<pre class="programlisting">println ant.references.antPath
println ant.references[<span xmlns:xslthl="http://xslthl.sf.net"
							class="hl-string">'antPath'</span>]</pre>
				</div>
			</div>
			<br class="example-break">
		</div>
		<div class="section">
			<div class="titlepage">
				<div>
					<div>
						<h2 class="title">
							<a name="N11533"></a>17.4.&nbsp;API
						</h2>
					</div>
				</div>
			</div>
			<p>
				The Ant integration is provided by <a class="ulink"
					href="../javadoc/org/gradle/api/AntBuilder.html" target="_top"><code
						class="classname">AntBuilder</code></a>.
			</p>
		</div>
		<div class="footnotes">
			<br>
			<hr align="left" width="100">
			<div class="footnote">
				<p>
					<sup>[<a href="#N113DF" name="ftn.N113DF" class="para">8</a>]
					</sup>In Groovy you can execute Strings. To learn more about executing
					external processes with Groovy have a look in 'Groovy in Action'
					9.3.2 or at the Groovy wiki
				</p>
			</div>
		</div>
	</div>
	<div class="navfooter">
		<div>
			<div class="navbar">
				<a xmlns:xslthl="http://xslthl.sf.net"
					href="working_with_files.html"
					title="Chapter&nbsp;16.&nbsp;Working With Files">Previous</a><span>|</span><a
					xmlns:xslthl="http://xslthl.sf.net" href="userguide.html"
					title="Gradle User Guide">Contents</a><span>|</span><a
					xmlns:xslthl="http://xslthl.sf.net" href="logging.html"
					title="Chapter&nbsp;18.&nbsp;Logging">Next</a>
			</div>
		</div>
	</div>
</body>
</html>